package com.gaofans.nrpc.common.exception;

/**
 * @author GaoFans
 */
public class NRpcException extends RuntimeException {

    private Integer code;

    private String message;

    public NRpcException(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public NRpcException(NRpcExceptionEnum exceptionEnum) {
        this.code = exceptionEnum.getCode();
        this.message = exceptionEnum.getMessage();
    }

    public NRpcException(Throwable cause, NRpcExceptionEnum exceptionEnum) {
        super(cause);
        this.message = exceptionEnum.getMessage();
        this.code = exceptionEnum.getCode();
    }

    public NRpcException(Throwable cause) {
        super(cause);
    }

    public Integer getCode() {
        return code;
    }

    @Override
    public String getMessage() {
        return message;
    }


}
